package com.eastfair.certificate.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.eastfair.core.base.entity.Entity;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.eastfair.core.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;
import com.eastfair.annotation.model.EchoVO;
import com.eastfair.certificate.enumeration.CarRecordInOrOutEnum;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 车辆出入证信息
 * </p>
 *
 * @author ligang
 * @since 2023-01-31
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("cert_car_record")
@ApiModel(value = "CarRecord", description = "车辆出入证信息")
@AllArgsConstructor
public class CarRecord extends Entity<Long> implements EchoVO {

    private static final long serialVersionUID = 1L;
    @TableField(exist = false)
    private Map<String, Object> echoMap = new HashMap<>();
    /**
     * 车牌号码
     */
    @ApiModelProperty(value = "车牌号码")
    @Size(max = 255, message = "车牌号码长度不能超过255")
    @TableField(value = "car_code", condition = LIKE)
    @Excel(name = "车牌号码")
    private String carCode;

    /**
     * 进场时间
     */
    @ApiModelProperty(value = "进场时间")
    @TableField(value = "in_time")
    @Excel(name = "进场时间", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime inTime;

    /**
     * 过场时间
     */
    @ApiModelProperty(value = "过场时间")
    @TableField(value = "pass_time")
    @Excel(name = "过场时间", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime passTime;

    /**
     * 车场id
     */
    @ApiModelProperty(value = "车场id")
    @Size(max = 255, message = "车场id长度不能超过255")
    @TableField(value = "park_id", condition = LIKE)
    @Excel(name = "车场id")
    private String parkId;

    /**
     * 进出场类型:#{IN:进场;OUT:出场;}
     */
    @ApiModelProperty(value = "进出场类型:#{IN:进场;OUT:出场;}")
    @TableField(value = "in_or_out")
    @Excel(name = "进出场类型:#{IN:进场;OUT:出场;}", replace = {"进场_IN", "出场_OUT",  "_null"})
    private CarRecordInOrOutEnum inOrOut;

    /**
     * 车辆本次进场出场标识
     */
    @ApiModelProperty(value = "车辆本次进场出场标识")
    @Size(max = 255, message = "车辆本次进场出场标识长度不能超过255")
    @TableField(value = "gu_id", condition = LIKE)
    @Excel(name = "车辆本次进场出场标识")
    private String guId;

    /**
     * 通道ID
     */
    @ApiModelProperty(value = "通道ID")
    @Size(max = 255, message = "通道ID长度不能超过255")
    @TableField(value = "channel_id", condition = LIKE)
    @Excel(name = "通道ID")
    private String channelId;

    /**
     * 通道名称
     */
    @ApiModelProperty(value = "通道名称")
    @Size(max = 255, message = "通道名称长度不能超过255")
    @TableField(value = "channel_name", condition = LIKE)
    @Excel(name = "通道名称")
    private String channelName;

    /**
     * 图片路径地址
     */
    @ApiModelProperty(value = "图片路径地址")
    @Size(max = 255, message = "图片路径地址长度不能超过255")
    @TableField(value = "image_path", condition = LIKE)
    @Excel(name = "图片路径地址")
    private String imagePath;

    /**
     * 是否启用：1是；0否
     */
    @ApiModelProperty(value = "是否启用：1是；0否")
    @TableField(value = "is_enabled")
    @Excel(name = "是否启用：1是；0否")
    private Integer isEnabled;

    /**
     * 是否删除：1是；0否
     */
    @ApiModelProperty(value = "是否删除：1是；0否")
    @TableField(value = "is_deleted")
    @Excel(name = "是否删除：1是；0否")
    private Integer isDeleted;

    /**
     * 租户id
     */
    @ApiModelProperty(value = "租户id")
    @TableField(value = "tenant_id")
    @Excel(name = "租户id")
    private Long tenantId;

    /**
     * 项目id
     */
    @ApiModelProperty(value = "项目id")
    @TableField(value = "project_id")
    @Excel(name = "项目id")
    private Long projectId;

    /**
     * 子系统id
     */
    @ApiModelProperty(value = "子系统id")
    @TableField(value = "subsystem_id")
    @Excel(name = "子系统id")
    private Long subsystemId;

    /**
     * 团队id
     */
    @ApiModelProperty(value = "团队id")
    @TableField(value = "team_id")
    @Excel(name = "团队id")
    private Long teamId;


    @Builder
    public CarRecord(Long id, Long createdBy, LocalDateTime createTime, Long updatedBy, LocalDateTime updateTime, 
                    String carCode, LocalDateTime inTime, LocalDateTime passTime, String parkId, CarRecordInOrOutEnum inOrOut, 
                    String guId, String channelId, String channelName, String imagePath, Integer isEnabled, Integer isDeleted, 
                    Long tenantId, Long projectId, Long subsystemId, Long teamId) {
        this.id = id;
        this.createdBy = createdBy;
        this.createTime = createTime;
        this.updatedBy = updatedBy;
        this.updateTime = updateTime;
        this.carCode = carCode;
        this.inTime = inTime;
        this.passTime = passTime;
        this.parkId = parkId;
        this.inOrOut = inOrOut;
        this.guId = guId;
        this.channelId = channelId;
        this.channelName = channelName;
        this.imagePath = imagePath;
        this.isEnabled = isEnabled;
        this.isDeleted = isDeleted;
        this.tenantId = tenantId;
        this.projectId = projectId;
        this.subsystemId = subsystemId;
        this.teamId = teamId;
    }

}
